Skip to content

feat: Add Webhook Reliability Architect kit - #334

Merged
akshatvirmani merged 3 commits into
Lamatic:mainfrom
amarkumar00:feat/webhook-reliability-architect
Aug 13, 2026
Merged

feat: Add Webhook Reliability Architect kit#334
akshatvirmani merged 3 commits into
Lamatic:mainfrom
amarkumar00:feat/webhook-reliability-architect

Conversation

@amarkumar00

@amarkumar00 amarkumar00 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adds the Webhook Reliability Architect AgentKit with a focused workflow for designing duplicate-safe webhook delivery
  • includes the Studio-exported Lamatic TypeScript flow, externalized prompts, constitution, and Gemini model configuration
  • ships a polished Next.js app that produces an idempotency contract, bounded retry policy, dead-letter replay plan, observability controls, failure analysis, and rollout evidence
  • supports both the deployed Lamatic flow and a deterministic local demo mode

Why

Webhook redelivery, lost acknowledgements, concurrent duplicates, and poison payloads can repeat real business side effects. This kit turns a sanitized delivery scenario into a concrete, reviewable reliability blueprint instead of generic retry advice.

Validation

  • npm run typecheck
  • npm run build
  • npm audit --audit-level=high — 0 vulnerabilities
  • all seven AgentKit @reference paths resolve
  • secret-pattern scan passes and no .env.local file is committed
  • Generate JSON node test, full Lamatic flow test, deployment, and live Next.js-to-Lamatic execution succeeded

Scope

All changes are contained in kits/webhook-reliability-architect/.

  • Added the Webhook Reliability Architect AgentKit in kits/webhook-reliability-architect/.
  • Added environment templates and ignore rules for Lamatic settings, demo mode, dependencies, build output, and logs.
  • Added README.md, agent.md, and constitutions/default.md with setup guidance, operating rules, safety boundaries, output requirements, and failure-mode guidance.
  • Added the Lamatic kit configuration in lamatic.config.ts.
  • Added the Studio-compatible TypeScript flow in flows/webhook-reliability-architect.ts.
    • Defines trigger, LLM, and response nodes.
    • Loads external system and user prompts.
    • Uses the configured Gemini model.
    • Accepts a webhook scenario and returns structured reliability analysis.
    • Covers idempotency, bounded retries, dead-letter replay, observability, failure modes, testing, and rollout.
  • Added Gemini model configuration in model-configs/.
  • Added externalized system and user prompts in prompts/.
  • Added the Next.js application in apps/.
    • Provides a client-side scenario form with delivery and failure settings.
    • Supports deployed Lamatic execution and deterministic demo mode.
    • Validates scenarios and parses structured analysis results.
    • Displays risk scores, idempotency guidance, retry schedules, dead-letter procedures, observability controls, failure modes, test cases, rollout steps, and JSON export.
  • Added Zod schemas and shared TypeScript types for webhook scenarios and reliability reports.
  • Added demo report generation with bounded risk scoring and scenario-specific reliability recommendations.
  • Added Lamatic client configuration with required environment validation.
  • Added dark responsive styling, page metadata, Next.js configuration, TypeScript configuration, and package scripts.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/webhook-reliability-architect

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1226af1a-3072-46aa-826b-86ce67769f73

📥 Commits

Reviewing files that changed from the base of the PR and between 999d939 and 5733b16.

📒 Files selected for processing (2)
  • kits/webhook-reliability-architect/apps/actions/orchestrate.ts
  • kits/webhook-reliability-architect/flows/webhook-reliability-architect.ts

Walkthrough

Changes

The pull request adds a Webhook Reliability Architect kit. It includes a Lamatic flow, structured reliability reports, deterministic and live analysis paths, and a Next.js interface for scenario input and report review.

Webhook Reliability Architect

Layer / File(s) Summary
Reliability contract and Lamatic flow
kits/webhook-reliability-architect/apps/lib/{schemas.ts,types.ts}, flows/*, prompts/*, constitutions/*, README.md, agent.md, lamatic.config.ts
Defines scenario and report contracts, reliability rules, prompts, model configuration, Lamatic flow wiring, kit metadata, setup instructions, and operational guardrails.
Deterministic demo report generation
kits/webhook-reliability-architect/apps/lib/demo.ts
Generates risk scores, retry schedules, idempotency plans, dead-letter procedures, observability requirements, failure modes, test cases, and rollout steps from scenario inputs.
Server analysis integration and app setup
kits/webhook-reliability-architect/apps/actions/orchestrate.ts, kits/webhook-reliability-architect/apps/lib/lamatic-client.ts, kits/webhook-reliability-architect/apps/{package.json,tsconfig.json,next.config.mjs,postcss.config.mjs}
Validates scenarios and report responses, selects demo or live execution, loads Lamatic credentials, and configures the Next.js application.
Next.js analysis workspace
kits/webhook-reliability-architect/apps/app/*
Adds the scenario form, submission states, reliability report views, JSON copy support, page metadata, responsive styling, and reduced-motion behavior.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the addition of the Webhook Reliability Architect kit and matches the primary change.
Description check ✅ Passed The description explains the kit, scope, purpose, validation performed, execution modes, and key deliverables.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@amarkumar00
amarkumar00 marked this pull request as ready for review August 10, 2026 07:21
@coderabbitai
coderabbitai Bot requested review from amanintech and d-pamneja August 10, 2026 07:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/webhook-reliability-architect/apps/.gitignore`:
- Around line 1-2: Update the ignore patterns in the repository’s .gitignore so
all environment files matching .env* are ignored, including production and local
variants, while explicitly unignoring .env.example.

In `@kits/webhook-reliability-architect/apps/actions/orchestrate.ts`:
- Around line 11-26: Harden validateScenario to reject non-object payloads
before property access, then validate every WebhookScenario field for the
expected string, enum, boolean, finite-integer, and size constraints before the
action generates a report or executes the flow. Explicitly reject NaN and other
non-finite numeric values, and return the existing validation-error shape rather
than throwing for malformed requests.
- Around line 29-64: Expand isReliabilityReport to validate the complete
ReliabilityReport contract, including the allowed riskLevel values, required
assumptions and rolloutSteps arrays, and the required nested fields in
idempotencyPlan, retryPlan.schedule, deadLetterPlan, and observability. Ensure
every required field has the expected type and structure so parseReport returns
a report only when fully valid, preventing incomplete data from reaching the
success response.

In `@kits/webhook-reliability-architect/apps/app/page.tsx`:
- Around line 95-97: Update the scrollIntoView call in the requestAnimationFrame
callback to choose "auto" when matchMedia("(prefers-reduced-motion: reduce)")
matches, and "smooth" otherwise, preserving the existing scroll target and
behavior.
- Around line 102-107: Update copyReport to catch failures from
navigator.clipboard.writeText and expose a copy-failure status through the
existing component state/UI. Set the success state and timeout only after the
write succeeds, while ensuring rejected clipboard promises are handled without
becoming unhandled rejections.

In `@kits/webhook-reliability-architect/apps/lib/demo.ts`:
- Line 123: In kits/webhook-reliability-architect/apps/lib/demo.ts lines
123-123, update the hasIdempotency detection to count protection only when
currentSafeguards explicitly describes persisted idempotency or deduplication;
do not treat generic event or payload identifiers as evidence. In the
identifier-selection logic at lines 140-143, use the sampled identifier only
when it is explicitly an event identifier; otherwise use the safe
<provider-event-id> fallback and state that assumption.

In `@kits/webhook-reliability-architect/apps/package.json`:
- Around line 11-22: Update kits/webhook-reliability-architect/apps/package.json
lines 11-22 to add Tailwind CSS v4+, react-hook-form, and zod. In
kits/webhook-reliability-architect/apps/app/page.tsx lines 75-100, replace
manual form state and validation with a Zod schema integrated through
react-hook-form while preserving the form’s behavior. In
kits/webhook-reliability-architect/apps/app/globals.css lines 68-96, replace
component-specific CSS with Tailwind utility-based styling and retain only
necessary global CSS variables; do not add shadcn/ui.

In `@kits/webhook-reliability-architect/flows/webhook-reliability-architect.ts`:
- Line 74: Update the Studio schema in the flow artifact so analysis and its
required ReliabilityReport fields—executiveSummary, riskScore, riskLevel,
idempotencyPlan, retryPlan, deadLetterPlan, observability, failureModes,
testMatrix, and rolloutSteps—are listed in required arrays. Constrain riskLevel
to the supported values low, moderate, high, and critical instead of accepting
arbitrary strings, then re-export the updated flow artifact.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a64bf63d-5096-4f6e-beac-77fd85d49a4b

📥 Commits

Reviewing files that changed from the base of the PR and between e0d0f8c and d66f528.

⛔ Files ignored due to path filters (1)
  • kits/webhook-reliability-architect/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • kits/webhook-reliability-architect/.env.example
  • kits/webhook-reliability-architect/.gitignore
  • kits/webhook-reliability-architect/README.md
  • kits/webhook-reliability-architect/agent.md
  • kits/webhook-reliability-architect/apps/.env.example
  • kits/webhook-reliability-architect/apps/.gitignore
  • kits/webhook-reliability-architect/apps/AGENTS.md
  • kits/webhook-reliability-architect/apps/CLAUDE.md
  • kits/webhook-reliability-architect/apps/actions/orchestrate.ts
  • kits/webhook-reliability-architect/apps/app/globals.css
  • kits/webhook-reliability-architect/apps/app/layout.tsx
  • kits/webhook-reliability-architect/apps/app/page.tsx
  • kits/webhook-reliability-architect/apps/lib/demo.ts
  • kits/webhook-reliability-architect/apps/lib/lamatic-client.ts
  • kits/webhook-reliability-architect/apps/lib/types.ts
  • kits/webhook-reliability-architect/apps/next-env.d.ts
  • kits/webhook-reliability-architect/apps/next.config.mjs
  • kits/webhook-reliability-architect/apps/package.json
  • kits/webhook-reliability-architect/apps/tsconfig.json
  • kits/webhook-reliability-architect/constitutions/default.md
  • kits/webhook-reliability-architect/flows/webhook-reliability-architect.ts
  • kits/webhook-reliability-architect/lamatic.config.ts
  • kits/webhook-reliability-architect/model-configs/webhook-reliability-architect_instructor-llmnode-437_generative-model-name.ts
  • kits/webhook-reliability-architect/prompts/webhook-reliability-architect_instructor-llmnode-437_system_0.md
  • kits/webhook-reliability-architect/prompts/webhook-reliability-architect_instructor-llmnode-437_user_1.md

Comment thread kits/webhook-reliability-architect/apps/.gitignore Outdated
Comment thread kits/webhook-reliability-architect/apps/actions/orchestrate.ts Outdated
Comment thread kits/webhook-reliability-architect/apps/actions/orchestrate.ts Outdated
Comment thread kits/webhook-reliability-architect/apps/app/page.tsx
Comment thread kits/webhook-reliability-architect/apps/app/page.tsx
Comment thread kits/webhook-reliability-architect/apps/lib/demo.ts Outdated
Comment thread kits/webhook-reliability-architect/apps/package.json
Comment thread kits/webhook-reliability-architect/flows/webhook-reliability-architect.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Hi @amarkumar00! 👋

Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review.

Steps to follow:

  1. Read through all CodeRabbit comments carefully
  2. Address each issue raised (or reply explaining why you disagree)
  3. Push your fixes as new commits
  4. Once all issues are resolved, comment here so we can re-review

This helps keep the review process efficient for everyone. Thank you! 🙏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/webhook-reliability-architect/apps/actions/orchestrate.ts (1)

80-87: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Mission brief — enforce the requested retry bounds on live reports.

isReliabilityReport accepts any positive retryPlan.maxAttempts and maxDeliveryAgeMinutes. A model response can exceed the validated scenario limits and still return success: true. The UI will then present an unsafe retry plan as a supported live report.

Compare the parsed report with validScenario before success. Reject a report when its attempt count, delivery-age budget, or schedule attempt count exceeds the requested bounds.

Proposed guard
+function respectsScenarioBounds(
+  report: ReliabilityReport,
+  scenario: WebhookScenario,
+): boolean {
+  return (
+    report.retryPlan.maxAttempts <= scenario.maxAttempts &&
+    report.retryPlan.maxDeliveryAgeMinutes <= scenario.maxDeliveryAgeMinutes &&
+    report.retryPlan.schedule.length <= scenario.maxAttempts &&
+    report.retryPlan.schedule.every((step) => step.attempt <= scenario.maxAttempts)
+  );
+}
+
     const report = parseReport(response);
-    if (!report) {
+    if (!report || !respectsScenarioBounds(report, validScenario)) {
       return {
         success: false,
-        error: "Lamatic returned an unexpected response shape. Verify the deployed flow output schema.",
+        error: "Lamatic returned a report outside the requested delivery bounds.",
       };
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/webhook-reliability-architect/apps/actions/orchestrate.ts` around lines
80 - 87, Before returning success in the parseReport flow, validate the parsed
report against validScenario’s requested retry limits. Reject reports whose
retryPlan.maxAttempts, maxDeliveryAgeMinutes, or schedule attempt count exceeds
the corresponding scenario bounds, while preserving the existing invalid-report
failure behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/webhook-reliability-architect/apps/actions/orchestrate.ts`:
- Around line 77-79: Update the orchestration path before client.executeFlow to
enforce the sensitive-data policy on validScenario: redact prohibited credential
or personal-data values, or reject the request when they are detected. Ensure
samplePayload, failureContext, and currentSafeguards cannot reach the live flow
unfiltered, independent of client-side warnings.

---

Outside diff comments:
In `@kits/webhook-reliability-architect/apps/actions/orchestrate.ts`:
- Around line 80-87: Before returning success in the parseReport flow, validate
the parsed report against validScenario’s requested retry limits. Reject reports
whose retryPlan.maxAttempts, maxDeliveryAgeMinutes, or schedule attempt count
exceeds the corresponding scenario bounds, while preserving the existing
invalid-report failure behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 40b22f4a-d567-46de-bb7b-728fecca0dcc

📥 Commits

Reviewing files that changed from the base of the PR and between d66f528 and 999d939.

⛔ Files ignored due to path filters (1)
  • kits/webhook-reliability-architect/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • kits/webhook-reliability-architect/README.md
  • kits/webhook-reliability-architect/apps/.gitignore
  • kits/webhook-reliability-architect/apps/actions/orchestrate.ts
  • kits/webhook-reliability-architect/apps/app/globals.css
  • kits/webhook-reliability-architect/apps/app/page.tsx
  • kits/webhook-reliability-architect/apps/lib/demo.ts
  • kits/webhook-reliability-architect/apps/lib/schemas.ts
  • kits/webhook-reliability-architect/apps/lib/types.ts
  • kits/webhook-reliability-architect/apps/package.json
  • kits/webhook-reliability-architect/apps/postcss.config.mjs
  • kits/webhook-reliability-architect/flows/webhook-reliability-architect.ts

Comment thread kits/webhook-reliability-architect/apps/actions/orchestrate.ts
@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation passed. The kit loaded successfully in Lamatic Studio.

This PR is ready for final review and merge.

@akshatvirmani

Copy link
Copy Markdown
Contributor

@amarkumar00 test 2 is failing, please check the above

@amarkumar00

Copy link
Copy Markdown
Contributor Author

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@amarkumar00

amarkumar00 commented Aug 13, 2026 via email

Copy link
Copy Markdown
Contributor Author

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@akshatvirmani
akshatvirmani merged commit 474c1d5 into Lamatic:main Aug 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants